geo_coord <- data %>%
filter(
!is.na(SCORE),
!is.na(Latitude),
!is.na(Longitude)
) %>%
mutate(
SCORE = as.numeric(SCORE),
info = str_c(
DBA,
paste("Cuisine: ", `CUISINE DESCRIPTION`),
paste("Score: ", SCORE),
sep = "<br />"
)
) %>%
select(Longitude, Latitude, SCORE, info)
map_density <- plot_ly(
data = geo_coord,
lat = ~Latitude,
lon = ~Longitude,
z = ~SCORE,
type = "densitymapbox",
colorscale = "Viridis",
radius = 5,
hovertext = ~info,
zmin = 0,
zmax = 40
)
map_density <- map_density %>%
layout(
title = "Density Plot of Inspection Scores of Restaurant in Manhattan",
mapbox = list(
style = 'carto-positron',
zoom = 13,
center = list(lon = -73.9712, lat = 40.7831)
),
margin = list(r = 0, t = 30, b = 0, l = 0)
)
map_density
<<<<<<< HEAD
=======